﻿using System;
using GeoAPI.Geometries;
using NetTopologySuite.Operation.Relate;

namespace HYCodeBase.TopologySuite
{
	public abstract class BaseRelateOperater
	{
		protected bool TryGetGeometryRelate(IGeometry inputGeometryOne, IGeometry inputGemetryTwo, out IntersectionMatrix relateResult)
		{
			return BaseRelateOperater.TryGetGeometryRelateStatic(inputGeometryOne, inputGemetryTwo, out relateResult);
		}

		internal static bool TryGetGeometryRelateStatic(IGeometry inputGeometryOne, IGeometry inputGemetryTwo, out IntersectionMatrix relateResult)
		{
			relateResult = null;
			if (inputGeometryOne == null || inputGemetryTwo == null)
			{
				return false;
			}
			bool result;
			try
			{
				relateResult = RelateOp.Relate(inputGeometryOne, inputGemetryTwo);
				result = true;
			}
			catch (Exception)
			{
				result = false;
			}
			return result;
		}
	}
}
